<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8" %>
<%@ include file="../common/taglibs.jsp" %>
<!--_meta 作为公共模版分离出去-->
<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <LINK rel="Bookmark" href="/favicon.ico" >
    <LINK rel="Shortcut Icon" href="/favicon.ico" />
    <!--[if lt IE 9]>
    <script type="text/javascript" src="lib/html5.js"></script>
    <script type="text/javascript" src="lib/respond.min.js"></script>
    <script type="text/javascript" src="lib/PIE_IE678.js"></script>
    <![endif]-->
    <link rel="stylesheet" type="text/css" href="static/h-ui/css/H-ui.min.css" />
    <link rel="stylesheet" type="text/css" href="static/h-ui.admin/css/H-ui.admin.css" />
    <link rel="stylesheet" type="text/css" href="lib/Hui-iconfont/1.0.7/iconfont.css" />
    <link rel="stylesheet" type="text/css" href="lib/icheck/icheck.css" />
    <link rel="stylesheet" type="text/css" href="static/h-ui.admin/skin/default/skin.css" id="skin" />
    <link rel="stylesheet" type="text/css" href="static/h-ui.admin/css/style.css" />
    <!--[if IE 6]>
    <script type="text/javascript" src="http://lib.h-ui.net/DD_belatedPNG_0.0.8a-min.js" ></script>
    <script>DD_belatedPNG.fix('*');</script>
    <![endif]-->
    <!--/meta 作为公共模版分离出去-->

    <title>添加过滤规则</title>
</head>
<body>
<form action="" method="post" class="form form-horizontal" id="form-member-add">






    <article class="page-container">
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red"> * </span>切换当前域名:</label>

            <div class="formControls col-xs-4 col-sm-3">
                 <span class="select-box">
            <select  id="domain" name="domain" class="select" >
            <c:forEach items="${domainList}" var="domain">
                <option value="${domain.domain_name}" >${domain.domain_name}</option>
            </c:forEach>

            </select>
                     </span>
                </div>

            </div>

        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>规则名称：</label>
            <div class="formControls col-xs-4 col-sm-3">
                <input type="text" class="input-text"   placeholder="" name="name" >
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>条件关系：</label>
            <div class="formControls col-xs-5 col-sm-4 skin-minimal">
                <div class="radio-box">
                    <input name="type" type="radio" id="type_0" checked  value="0">
                    <label for="type_0">满足所有条件</label>
                </div>
                <div class="radio-box">
                    <input type="radio" id="type_1" name="type" value="1" >
                    <label for="type_1">满足一个条件</label>
                </div>

            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red"></span>条件1：</label>
            <div class="formControls col-xs-5 col-sm-2 skin-minimal">
                <span class="select-box">
                <select  name="ruleDetailDomainList[0].rulekey" class="select">
                    <option value="1">所有邮件</option>

                </select>
                    </span>
            </div>
            <div class="formControls col-xs-5 col-sm-2 skin-minimal">
                 <span class="select-box">
                <select  name="ruleDetailDomainList[0].conditions" class="select">
                    <option value="1">包含</option>
                    <option value="2">等于</option>
                    <option value="3">不包含</option>

                </select>
                     </span>
            </div>
            <div class="formControls col-xs-5 col-sm-4 skin-minimal">
                <input name="ruleDetailDomainList[0].rulevalue"  type="text" class="input-text">
                </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red"></span>条件2：</label>
            <div class="formControls col-xs-5 col-sm-2 skin-minimal">
                <span class="select-box">
                <select id="rulekey" name="ruleDetailDomainList[1].rulekey" class="select">
                    <option value="2">发件人</option>
                </select>
                    </span>
            </div>
            <div class="formControls col-xs-5 col-sm-2 skin-minimal">
                 <span class="select-box">
                <select id="condition" name="ruleDetailDomainList[1].conditions" class="select">
                    <option value="1">包含</option>
                    <option value="2">等于</option>
                    <option value="3">不包含</option>

                </select>
                     </span>
            </div>
            <div class="formControls col-xs-5 col-sm-4 skin-minimal">
                <input name="ruleDetailDomainList[1].rulevalue" id="rulevalue" type="text" class="input-text">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red"></span>条件3：</label>
            <div class="formControls col-xs-5 col-sm-2 skin-minimal">
                <span class="select-box">
                <select  name="ruleDetailDomainList[2].rulekey" class="select">
                    <option value="3">收件人</option>
                </select>
                    </span>
            </div>
            <div class="formControls col-xs-5 col-sm-2 skin-minimal">
                 <span class="select-box">
                <select  name="ruleDetailDomainList[2].conditions" class="select">
                    <option value="1">包含</option>
                    <option value="2">等于</option>
                    <option value="3">不包含</option>

                </select>
                     </span>
            </div>
            <div class="formControls col-xs-5 col-sm-4 skin-minimal">
                <input name="ruleDetailDomainList[2].rulevalue"  type="text" class="input-text">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red"></span>条件4：</label>
            <div class="formControls col-xs-5 col-sm-2 skin-minimal">
                <span class="select-box">
                <select  name="ruleDetailDomainList[3].rulekey" class="select">
                    <option value="4">邮件内容</option>
                </select>
                    </span>
            </div>
            <div class="formControls col-xs-5 col-sm-2 skin-minimal">
                 <span class="select-box">
                <select  name="ruleDetailDomainList[3].conditions" class="select">
                    <option value="1">包含</option>
                    <option value="2">等于</option>
                    <option value="3">不包含</option>

                </select>
                     </span>
            </div>
            <div class="formControls col-xs-5 col-sm-4 skin-minimal">
                <input name="ruleDetailDomainList[3].rulevalue"  type="text" class="input-text">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red"></span>操作：</label>
            <div class="formControls col-xs-5 col-sm-2 skin-minimal">
                <span class="select-box">
                <select  name="menthod" id="menthod" class="select">
                    <option value="1">删除邮件</option>
                    <option value="2">移动至</option>
                </select>

                    </span>

            </div>

            <div class="formControls col-xs-5 col-sm-2 skin-minimal">
            <span class="select-box" id="destation" style="display: none">
                      <select  name="destation"  class="select">
                           <option value="1">收件箱</option>
                            <option value="2">发件箱</option>
                          <option value="4">垃圾箱</option>
                          <option value="6">可疑箱</option>
                      </select>
                      </span>
                </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>顺序：</label>
            <div class="formControls col-xs-4 col-sm-3">
                <input type="text" class="input-text"  placeholder="" name="ordertype" id="ordertype">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red"></span>状态：</label>
            <div class="formControls col-xs-5 col-sm-4 skin-minimal">
                <div class="radio-box">
                    <input name="status" type="radio" id="status_1" checked  value="1">
                    <label for="status_1">正常</label>
                </div>
                <div class="radio-box">
                    <input type="radio" id="status_2" name="status" value="0" >
                    <label for="status_2">禁用</label>
                </div>

            </div>
        </div>


        <div class="row cl">
            <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
                <input class="btn btn-primary radius" type="submit" value="&nbsp;&nbsp;提交&nbsp;&nbsp;">
            </div>
        </div>

    </article>
</form>

<!--_footer 作为公共模版分离出去-->
<script type="text/javascript" src="lib/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="lib/layer/2.1/layer.js"></script>
<script type="text/javascript" src="lib/icheck/jquery.icheck.min.js"></script>
<script type="text/javascript" src="lib/jquery.validation/1.14.0/jquery.validate.min.js"></script>
<script type="text/javascript" src="lib/jquery.validation/1.14.0/validate-methods.js"></script>
<script type="text/javascript" src="lib/jquery.validation/1.14.0/messages_zh.min.js"></script>
<script type="text/javascript" src="static/h-ui/js/H-ui.js"></script>
<script type="text/javascript" src="static/h-ui.admin/js/H-ui.admin.js"></script>
<!--/_footer /作为公共模版分离出去-->

<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript">
    $(function(){


        $("#menthod").on('change',function () {
            var a = $(this).val();
            if("2"==a){
                $("#destation").show();
            }else{
                $("#destation").hide();
            }
        });
        $('.skin-minimal input').iCheck({
            checkboxClass: 'icheckbox-blue',
            radioClass: 'iradio-blue',
            increaseArea: '20%'
        });


        $("#form-member-add").validate({
            rules:{
                name:{
                    required:true,
                    minlength:2,
                    maxlength:16
                },
                ordertype:{
                    required:true,
                    number:true
                },
                domain:{
                    required:true,
                }
            },
            onkeyup:false,
            focusCleanup:true,
            success:"valid",
            submitHandler:function(form){
                //  var index = parent.layer.getFrameIndex(window.name);
                $.ajax({
                    url: "ruleSave.htmlx",
                    type:"POST",
                    data:$(form).serializeArray(),
                    dataType:'json',
                    success: function(data){
                         parent.location.reload();
                         parent.layer.close(index);
                        layer.msg('保存成功!',{icon: 1,time:1000});
                    },
                    error: function(data){
                        layer.msg('操作失败!请联系系统管理员!',{icon: 5,time:1000});
                    }
                })
            }
        });
    });
</script>
<!--/请在上方写此页面业务相关的脚本-->
</body>
</html>